home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / moonphas.tar / moonphase < prev    next >
Internet Message Format  |  1990-08-24  |  5KB

  1. From fin@norge.unet.umn.edu Fri Apr  6 22:42:03 1990
  2. From: fin@norge.unet.umn.edu (Craig A. Finseth)
  3. Newsgroups: comp.sys.handhelds
  4. Subject: HP-48SX Program to Calculate/Show the Phase of the Moon
  5. Date: 2 Apr 90 21:28:12 GMT
  6. Organization: Univ Netw Serv, Univ of Minn
  7.  
  8.  
  9. In order for bugs to depend on the phase of the moon, they must first
  10. be able to find out what the phase of the moon is.  This program
  11. should help.
  12.  
  13. Note: this program uses a first-order sin approximation.  The correct
  14. expression contains about 30 sin terms.  Still, what you see displayed
  15. corresponds reasonably well with what you see in the sky...
  16.  
  17. Written by: Craig Finseth, University of Minnesota
  18. From: 29 Mar 1990
  19. What: Phase of Moon Display
  20.  
  21. MPHASE    Calculate and show the phase of the moon for the current date/time
  22. MTIME    Calculate and show the moon time string for the current date/time
  23. MFRAC    Calculate the moon phase fraction (0 new moon; .25 first quarter;
  24.     .5 full moon; .75 last quarter)
  25. FLIP    Invert the screen.  Fast, but displays garbage during the flip.
  26. MPLOT    Internal to MPHASE: Plot the crescent
  27. MLINE    Internal to MPHASE: Draw a line of the crescent
  28.  
  29. MFINI    Internal to MPHASE: display the stars, call FLIP
  30. SLOFLIP    An alternate, slow but smooth flip.
  31.  
  32. Notes:
  33.  
  34. - If you want to generalize the date/time caluclated for, change
  35. MFRAC.
  36.  
  37. - You can omit the flip by removing the call to FLIP from MFINI.
  38.  
  39. - You can omit both the flip and the stars by removing the call to
  40. MFINI from MPHASE.
  41.  
  42. - The base time for new moon is 12 Jan 1975 at 10:21 am GMT (4:21 AM
  43. CST, which is the figure used in the program).
  44.  
  45. - The moon cycle is assumed to by 42,532 minutes long.
  46.  
  47. - The stars displayed are just random bits: they do not correspond to
  48. real stars.
  49.  
  50. Checksum: #12458d
  51. Size: 1397.5
  52. ------------------------------------------------------------
  53. %%HP: T(3)A(D)F(.);
  54. DIR
  55.   MPHASE
  56.     \<< RCLF -31 SF
  57. DEG ERASE { # 0d
  58. # 0d } PVIEW {
  59. # 64d # 28d } # 26d
  60. 0 360 ARC 26 28
  61. MFRAC MPLOT MFINI 7
  62. FREEZE STOF
  63.     \>>
  64.   MTIME
  65.     \<< MFRAC \-> X
  66.       \<<
  67.         IF X .25 <
  68.         THEN "NM+"
  69.         ELSE
  70.           IF X .5 <
  71.           THEN
  72. "FQ+"
  73.           ELSE
  74.             IF X
  75. .75 <
  76.             THEN
  77. "FM+"
  78.             ELSE
  79. "LQ+"
  80.             END
  81.           END
  82.         END X
  83.       \>> .25 MOD
  84. 42532 * SWAP OVER
  85. 1440 / IP \->STR +
  86. "d " + SWAP 1440
  87. MOD SWAP OVER 60 /
  88. IP \->STR + "h " +
  89. SWAP 60 MOD SWAP
  90. OVER IP \->STR + "m "
  91. + SWAP FP 60 * IP
  92. \->STR + "s" +
  93.     \>>
  94.   MFRAC
  95.     \<< 1.121975 DATE
  96. DDAYS TIME 4.21
  97. HMS- HMS\-> 24 / +
  98. 1440 * 42532 / FP
  99.     \>>
  100.   FLIP
  101.     \<< PICT RCL NEG
  102. PICT STO
  103.     \>>
  104.   MPLOT
  105.     \<< \-> RA MI F
  106.       \<<
  107.         IF F .5 <
  108.         THEN F 360
  109. * COS RA * RA
  110.         ELSE RA NEG
  111. F .5 - 360 * COS RA
  112. *
  113.         END \-> L R
  114.         \<< 1 0
  115.           FOR x x
  116. ACOS SIN DUP MI x
  117. RA * + L R MLINE MI
  118. x RA * - L R MLINE
  119. RA INV NEG
  120.           STEP
  121.         \>>
  122.       \>>
  123.     \>>
  124.   MLINE
  125.     \<< \-> SC LI L R
  126.       \<< SC L * 64 +
  127. R\->B LI R\->B 2 \->LIST
  128. SC R * 64 + R\->B LI
  129. R\->B 2 \->LIST LINE
  130.       \>>
  131.     \>>
  132.   MFINI
  133.     \<< { # 10d # 10d
  134. } PIXON { # 110d
  135. # 15d } PIXON {
  136. # 100d # 50d }
  137. PIXON { # 30d # 41d
  138. } PIXON { # 31d
  139. # 41d } PIXON FLIP
  140.     \>>
  141.   SLOFLIP
  142.     \<< 0 63
  143.       FOR l # 0d l
  144. R\->B 2 \->LIST # 130d
  145. l R\->B 2 \->LIST TLINE
  146.       NEXT
  147.     \>>
  148. END
  149.  
  150. Craig A. Finseth            fin@unet.umn.edu [CAF13]
  151. University Networking Services        +1 612 624 3375 desk
  152. University of Minnesota            +1 612 626 1002 FAX
  153. 130 Lind Hall, 207 Church St SE, Minneapolis MN 55455-0134, U.S.A.
  154.  
  155. From prestonb@hpcvra.CV.HP.COM Mon Apr  9 18:09:39 1990
  156. From: prestonb@hpcvra.CV.HP.COM (Preston Brown)
  157. Newsgroups: comp.sys.handhelds
  158. Subject: Re: HP-48SX Program to Calculate/Show the Phase of the Moon
  159. Date: 6 Apr 90 23:22:07 GMT
  160. Organization: Hewlett-Packard Co., Corvallis, OR, USA
  161.  
  162. If you don't want to glitch the display then change FLIP to:
  163.  
  164. FLIP
  165. \<< PICT PICT RCL NEG {#0 #0} SWAP REPL \>>
  166.  
  167. This version is also faster.
  168.  
  169. Preston
  170.  
  171. From jmunkki@kampi.hut.fi Mon Apr  9 18:10:54 1990
  172. From: jmunkki@kampi.hut.fi (Juri Munkki)
  173. Newsgroups: comp.sys.handhelds
  174. Subject: Re: HP-48SX Program to Calculate/Show the Phase of the Moon
  175. Date: 8 Apr 90 09:53:33 GMT
  176. Reply-To: jmunkki@kampi.hut.fi (Juri Munkki)
  177. Organization: Helsinki University of Technology, FINLAND
  178.  
  179. In <21580056@hpcvra.CV.HP.COM> prestonb@hpcvra.CV.HP.COM (Preston Brown):
  180. >If you don't want to glitch the display then change FLIP to:
  181. >
  182. >FLIP
  183. >\<< PICT PICT RCL NEG {#0 #0} SWAP REPL \>>
  184. >
  185. >This version is also faster.
  186.  
  187. What's wrong with just doing PICT NEG? Works fine and is visibly faster.
  188. What would you call glitching the display?
  189.  
  190.    ___________________________________________________________________________
  191.   / Juri Munkki        /  Helsinki University of Technology   /  Wind  /   HP S /
  192.  / jmunkki@hut.fi  /  Computing Center Macintosh Support  /  Surf  /   48 X /
  193.  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  194.  
  195.